//https://www.youtube.com/watch?v=PksUUwvq-po
#include <iostream>

class Entity
{

public:
	Entity() = default;

	const std::string& GetName() const { return m_Name; };
	void PrintType()
	{
		std::cout << "Entity\n";
	}
private: 

	Entity* m_Parent; // 0
	std::string m_Name; //8
};

// struct cannot have functions inside them
struct EntityData
{
	EntityData* m_Parent; // 0
	std::string m_Name; //8
};

const std::string& Entity_GetName(const EntityData* self) //self is an instance
{ 
	//self == nullptr

	uint64_t offset = offsetof(EntityData, m_Name);
	return self->m_Name;
};
void Entity_PrintType(EntityData* self)
{
	//self == nullptr
	std::cout << "Entity\n";
}

int main()
{
	void* value = NULL;

	Entity* entity = nullptr;
	entity->PrintType();
	uint64_t offset = offsetof(EntityData, m_Name);
	std::cout << "Offset of m_Name: " << offset << std::endl;

	std::cout<< entity->GetName() << std::endl;// Cause error but in vs2022, this cast only a warning 
	std::cin.get();
}